package com.wzcl.app.controller;


import com.wzcl.app.service.common.AliPayService;
import com.wzcl.app.service.common.PolyvService;
import com.wzcl.app.service.common.QiNiuService;
import com.wzcl.app.service.common.WxPayService;
import io.swagger.annotations.Api;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Log4j2
@RestController
@RequestMapping("/callback")
@Api(value="回调controller",tags={"回调相关接口"})
public class CallbackController {

    @Resource
    private AliPayService aliPayService;

    @Resource
    private WxPayService wxPayService;

    @Resource
    private QiNiuService qiNiuService;

    @Resource
    private PolyvService polyvService;


    @Transactional
    @RequestMapping("/aliPay_notify_callback")
    public void aliPayNotify(HttpServletRequest request, HttpServletResponse response){
        aliPayService.notify(request,response);
    }

    @Transactional
    @RequestMapping("/wxPay_notify_callback")
    public void wxPayNotify(HttpServletRequest request, HttpServletResponse response){
        wxPayService.notify(request,response);
    }

    @Transactional
    @RequestMapping("/wxPay_refund_notify_callback")
    public void wxPayRefundNotify(HttpServletRequest request, HttpServletResponse response){
        wxPayService.refundNotify(request,response);
    }

    @Transactional
    @RequestMapping("/file_notify_callback")
    public void qiNiuFileNotify(HttpServletRequest request, HttpServletResponse response){
        qiNiuService.notify(request,response);
    }

    @Transactional
    @RequestMapping("/polyv_auth_notify_callback")
    public void polyvAuthNotify(HttpServletRequest request, HttpServletResponse response){
        polyvService.notify(request,response);
    }


    @Transactional
    @RequestMapping("/polyv_stream_notify_callback")
    //设置账号下频道直播状态改变通知回调地址的接口(bolyv官网设置)
    public void polyvStreamNotify(HttpServletRequest request, HttpServletResponse response){
        polyvService.streamNotify(request,response);
    }

}
